<?php

	require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
	
	$session = get_entity(get_input("chatsession"));
	
	$maxmembers = get_entities_from_relationship("elggchat_session_member", $session->guid, null, null, null, null, null, null, null, true);
	$members = get_entities_from_relationship("elggchat_session_member", $session->guid, null, null, null, null, null, $maxmembers);

	$maxinvites = get_entities_from_relationship("elggchat_session_member_invite", $session->guid, null, null, null, null, null, null, null, true);
	$invites = get_entities_from_relationship("elggchat_session_member_invite", $session->guid, null, null, null, null, null, $maxinvites);
	

?>

	<h3 class='settings'><?php echo elgg_echo('elggchat:session_info:title');?></h3>
	<p>
		<?php echo elgg_echo('elggchat:session_info:id') . " " . $session->guid; ?><br />
		<?php echo elgg_echo('elggchat:session_info:started') . " " . friendly_time($session->time_created); ?><br />
	</p>
	<h3 class='settings'><?php echo elgg_echo('elggchat:session_info:members');?></h3>
	<p>
		<?php
			foreach($members as $member){
				echo $member->name . "<br />";
			}
		?>
	</p>
	<?php
		if($invites){
	?>
	<h3 class='settings'><?php echo elgg_echo('elggchat:session_info:invitations');?></h3>
	<p>
		<?php
			foreach($invites as $invitation){
				echo $invitation->name . "<br />";
			}
		?>
	</p>
	
	<?php
		}
		echo "<center>" .  elgg_view("input/button", array("type"=>"button","value"=>elgg_echo("close"),"js"=>"onclick='javascript:showChat(" . $session->guid . ");'")) . "</center>";		
	?>

	
